<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>Document</title>
</head>
<body>
   用户名：<input type="text" class="username"><br>
   密码：<input type="text" class="password"><br>
   验证码：<input type="text" class="code1" value="r2b7"><br>
   手机号：<input type="text" class="tel" ><br>
   <button>注册</button>
   <script src="https://code.jquery.com/jquery-3.6.1.js"></script>
   <script>
       $("button").click(function(){
         console.log($(".tel").val());
         $.ajax({
            url:"http://127.0.0.1:3000/users/register",
            data:{
               phone:$(".tel").val(),
               code:$(".code1").val(),
               username:$(".username").val(),
               password:$(".password").val()
            },
            type:"post",
            success:function(res){
               console.log(res);
               if(res.status == 200){
                  //提示成功 跳转到登录
                  //alert(res.msg)
                  location.href="./index.html"
               }
            }
         })
         
       })
   </script>
</body>
</html>